package com.example.quartz.demo.job;

import com.example.quartz.demo.BaseJob;
import com.example.quartz.demo.service.QuartzService;
import com.example.quartz.demo.service.TestMapper;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 发送测试短信
 */
public class SyHelloJob implements BaseJob {
	private static final long serialVersionUID = 1L;
	private SimpleDateFormat dateFormat() {
	        return new SimpleDateFormat("HH:mm:ss");
	    }

	@Autowired
	private TestMapper testMapper;


	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		JobDetail jobDetail = context.getJobDetail();
		System.out.println(testMapper+"--定时任务2:" + jobDetail.getKey().getName() + "执行时间" + dateFormat().format(new Date()));
		testMapper.test("黎明");
	}



}
